package com.example.iread.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;

import com.example.iread.bean.BookBean;
import com.example.iread.bean.SearchHistoryBean;

import java.util.List;

@Dao
public interface SearchHistoryDao {

    @Insert
    void insert(SearchHistoryBean ...searchHistoryBeans);

    @Delete
    void delete(SearchHistoryBean ...searchHistoryBeans);


    @Query("SELECT * FROM search_history ORDER BY createTime DESC LIMIT 10")
    List<SearchHistoryBean> getList();

    @Query("DELETE FROM search_history")
    void deleteAll();

    @Query("DELETE FROM search_history WHERE id = :id")
    void deleteById(int id);

}
